package org.jeecg.modules.es.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.jeecg.constant.ElasticSearchConstant;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * TODO:
 *
 * @author Zhang Hao yu
 * @date 2020/12/2 17:30
 */
@Configuration
public class ElasticSearchConfig {


    @Bean
    public RestHighLevelClient restHighLevelClient(){
        RestHighLevelClient restHighLevelClient = new RestHighLevelClient(
                RestClient.builder(
                        new HttpHost(ElasticSearchConstant.HOSTNAME,ElasticSearchConstant.PORT,"http")));
        return restHighLevelClient;
    }
}